import time

# 使用struct_time获取年月日
timestamp = time.time() # 获取时间戳
strct_time = time.localtime(timestamp)
year = strct_time.tm_year
month = strct_time.tm_mon
day = strct_time.tm_mday
print(f"今天是{year}年{month}月{day}日")

# 使用timefromt获取年月日
timestamp = time.time() # 获取时间戳
strct_time = time.localtime(timestamp)
date_str = time.strftime("%Y-%m-%d",strct_time)
print(date_str)


result = date_str.split("-")
print(result)
print(f"今天是{result[0]}年{result[1]}月{result[2]}日")